#include <cstdio>
#include <queue>
using namespace std;
#define DEBUG

#define int long long
int n, m, count1; //1的数量
priority_queue<int, vector<int>, greater<int>> heap;

inline void init()
{
    while(heap.size()) heap.pop(); //清空堆
    count1=0;
}

inline int lowbit(int x) //最低位1
{
    return x&(-x);
}

inline bool is2(int x) //是否是2的非负次方
{
    if(x==1) return true;
    return !(x&(x-1));
}

void PrintAns()
{
    while(count1--) printf("1 ");
    while(heap.size()) printf("%lld ", heap.top()), heap.pop();
}

signed main()
{
    #ifdef DEBUG
        freopen("../in.txt", "r", stdin);
        freopen("../out.txt", "w", stdout);
    #endif
    int n; scanf("%d", &n);
    while(n--)
    {
        init();
        scanf("%lld", &m);
        
        while(m>0)  {
            heap.push(lowbit(m)); //把m的每一位压入堆中
            m-=lowbit(m);
        }

        while(!is2(heap.size()+count1)) { //长度不是2的非负次幂
            int u=heap.top(); heap.pop();
            // printf("u:%d\n", u);
            if(u==1) count1++;
            else
            {
                heap.push(u>>1);
                heap.push(u>>1);
            }       
        }
        PrintAns();
        puts("");
    }   

    return 0;
}